import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'login',
    meta: {
      title: '登录',
      keepAlive: true,
      requireAuth: false
    },
    component: () => import('@/views/login.vue')
  },
  {
    path: '/',
    name: 'layout',
    meta: {
      title: '首页',
      keepAlive: true,
      requireAuth: true
    },
    component: () => import('@/views/layout/index.vue'),
    children: [
      {
        path: 'bill',
        name: 'bill',
        component: () => import('@/views/bill/index.vue')
      },
      {
        path: 'stat',
        name: 'stat',
        component: () => import('@/views/stat/index.vue')
      },
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/user/index.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})
export default router
